<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ include file="/system/include/taglib.jsp"%>
<%@ page import="java.util.*" %>
<%@ page import="com.zhongkai.model.config.Menu" %>
<%@ page import="com.zhongkai.model.config.Button" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>角色权限管理</title>
<link type="text/css" rel="stylesheet" href="/system/css/style.css" />
<script type="text/javascript" language="javascript" src="/system/js/public.js"></script>
<script type="text/javascript" language="javascript" src="/system/js/jquery-1.4.2.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function(){
	$("#checkAll").click(function(){
		$("input[name='actionKey']").attr("checked",true);
	});
	$("#checkNon").click(function(){
		$("input[name='actionKey']").attr("checked",false);
	});
});
function reback(url){
	location.href=url;
}
</script>
</head>
<body>
<mytag:View name="role" table="com.zhongkai.model.config.Role" id="${param.rid }"></mytag:View>
<div class="main">
	<div class="position">当前位置: <a href="/sysadm/desktop.jsp">桌 面</a> → <a href="rolelist.jsp">角色管理</a> → 权限管理</div>
	<div class="mainbody">
		<div class="toolbar">
			工具栏：
			<input id="checkAll" type="button" value="全选" class="system_button" />
			<input id="checkNon" type="button" value="全不选" class="system_button" />
			<input type="button" value="返回" class="system_button" onclick="reback('rolelist.jsp')" />
		</div>
		<div class="operate_info">
			<font color="#FF0000"><label id="explaininfo">当前选择角色：${role.roleName }</label></font>
		</div>
		<div class="table">
			<form action="/system/config/action.do" method="post">
				<input name="roleId" type="hidden" value="${role.roleId }" />
				<table width="100%" border="0" cellpadding="1" cellspacing="1" class="table_list">
					<tr>
						<th>菜单名称</th>
						<th>链接地址</th>
						<th>操作键</th>
						<th>操作</th>
					</tr>
					<mytag:listMenuForActionSet menu1="menuList1" menu2="menuList2" menu3="menuList3"></mytag:listMenuForActionSet>
					<mytag:List field="actionKey" name="menuActionList" table="Action">actionType=0 and roleId=${role.roleId }</mytag:List>
					<%
						Object[] menuActionKeys=null;
						List menuActionList=(List)pageContext.getAttribute("menuActionList");
						if(menuActionList!=null && menuActionList.size()>0){
							menuActionKeys=menuActionList.toArray();
							Arrays.sort(menuActionKeys);
						}
					%>
					<logic:iterate id="menu1" name="menuList1">
						<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
							<td>
								${menu1.menuName }
								<input name="${menu1.actionKey }" type="hidden" value="0" />
							</td>
							<td>${menu1.menuUrl }</td>
							<td>${menu1.actionKey }</td>
							<td>
								<input type="button" value="修改" class="system_button" onclick="mod(${role.roleId })"  />
								<input type="button" value="删除" class="system_button" onclick="del(${role.roleId })"  />
							</td>
						</tr>
						<logic:iterate id="menu2" name="menuList2">
							<c:if test="${menu2.menuParent==menu1.menuId }">
								<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
									<td style="padding-left:20px;">
										∟${menu2.menuName }
										<input name="${menu2.actionKey }" type="hidden" value="0" />
									</td>
									<td>${menu2.menuUrl }</td>
									<td>${menu2.actionKey }</td>
									<td>
										<input type="button" value="修改" class="system_button" onclick="mod(${role.roleId })"  />
										<input type="button" value="删除" class="system_button" onclick="del(${role.roleId })"  />
									</td>
								</tr>
								<logic:iterate id="menu3" name="menuList3">
									<c:if test="${menu3.menuParent==menu2.menuId }">
										<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
											<td style="padding-left:50px;">
												∟${menu3.menuName }
												<input name="${menu3.actionKey }" type="hidden" value="0" />
											</td>
											<td>${menu3.menuUrl }</td>
											<td>${menu3.actionKey }</td>
											<td>
												<input type="button" value="修改" class="system_button" onclick="mod(${role.roleId })"  />
												<input type="button" value="删除" class="system_button" onclick="del(${role.roleId })"  />
											</td>
										</tr>
									</c:if>
								</logic:iterate>
							</c:if>
						</logic:iterate>
					</logic:iterate>
				</table>
			</form>
		</div>
	</div>
</div>
</body>
</html>
